int press_bottom_times;                     

void setup() {

pinMode(PA15,INPUT_PULLUP);                  //将PA15引脚设置为输入上拉模式  
pinMode(PC5,OUTPUT);                         //将PC5引脚设置为输出模式
pinMode(PB0,OUTPUT);                         //将PB0引脚设置为输出模式
pinMode(PB1,OUTPUT);                         //将PB1引脚设置为输出模式
digitalWrite(PC5,HIGH);                      //将PC5引脚初始化为高电平
digitalWrite(PB0,HIGH);                      //将PB0引脚初始化为高电平
digitalWrite(PB1,HIGH);                      //将PB1引脚初始化为高电平

attachInterrupt(PA15, PRESS_BOTTOM, FALLING); //PA15引脚下降沿时产生中断，执行PRESS_BOTTOM函数
}

void loop() {
  if(press_bottom_times==1)
  {
    digitalWrite(PC5,HIGH);                  //将PC5引脚输出高电平   -->红灯灭  
    digitalWrite(PB0,HIGH);                  //将PB0引脚输出高电平   -->黄灯灭
    digitalWrite(PB1,LOW);                   //将PB1引脚输出低电平   -->蓝灯亮
  }
  else if(press_bottom_times==2)
  {
    digitalWrite(PC5,HIGH);                  //将PC5引脚输出高电平   -->红灯灭  
    digitalWrite(PB0,LOW);                   //将PB0引脚输出低电平   -->黄灯亮
    digitalWrite(PB1,HIGH);                  //将PB1引脚输出高电平   -->蓝灯灭  
  }
  else if(press_bottom_times==3)
  {
    digitalWrite(PC5,LOW);                   //将PC5引脚输出低电平   -->红灯亮  
    digitalWrite(PB0,HIGH);                  //将PB0引脚输出高电平   -->黄灯灭
    digitalWrite(PB1,HIGH);                  //将PB1引脚输出高电平   -->蓝灯灭  
  }
  else press_bottom_times=1;                 //当press_bottom_times数值不为1、2、3的情况下的它的值都为1
}

void PRESS_BOTTOM(){
 press_bottom_times=press_bottom_times+1;
}
